#include <string>
#include <sys/time.h>

using namespace std;

class CMyApi;
class CMySpi :
	public CThostFtdcTraderSpi
{
public:
	CMySpi(CMyApi * pApi);
	virtual ~CMySpi();

	virtual void OnFrontConnected();
	virtual void OnFrontDisconnected(int nReason);
	virtual void OnRspAuthenticate(CThostFtdcRspAuthenticateField *pRspAuthenticateField, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
	virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
	virtual void OnRspQryDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
public:
	CMyApi * m_pApi;
	//临时错误返回转码存储变量
	char tmpmsg[81];

	//时间统计变量
	struct  timeval endtime;
	int timegap;

	//tmp instrid
	string tmpinstrid;
};